<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<svg width="400" height="400">
    <rect id="target" x="10" y="10" width="80" height="80">
        <animate attributeType="XML" attributeName="x" from="10" to="210" dur="10" additive="replace" />
    </rect>
</svg>
<script>
'use strict';

// From UseCounter.h
var SVGSMILAdditiveAnimation = 1484;

async_test(function(testHandle) {
    window.onload = function() {
        var animation = document.createElementNS("http://www.w3.org/2000/svg", "animate");
        animation.setAttribute("attributeType", "XML");
        animation.setAttribute("attributeName", "y");
        animation.setAttribute("from", "10");
        animation.setAttribute("to", "210");
        animation.setAttribute("dur", "10");
        animation.setAttribute("additive", "sum");
        requestAnimationFrame(testHandle.step_func(function() {
            assert_false(internals.isUseCounted(document, SVGSMILAdditiveAnimation));
            target.appendChild(animation);
            requestAnimationFrame(testHandle.step_func_done(function() {
                assert_true(internals.isUseCounted(document, SVGSMILAdditiveAnimation));
            }));
        }));
    };
}, "Additive SMIL animation is counted");

</script>
